package com.shop.cloud.mall.api.controller;

import com.aliyuncs.exceptions.ClientException;
import com.shop.cloud.common.core.util.R;
import com.shop.cloud.mall.api.service.PhoneService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author
 * @date 2018/11/14
 * <p>
 * 手机验证码
 */
@RestController
@AllArgsConstructor
@RequestMapping("/phone")
@Tag(description = "phone", name = "手机验证码API")
public class PhoneController {
	private final PhoneService phoneService;

	/**
	 * 发送手机验证码
	 * @param phone
	 * @return
	 * @throws ClientException
	 */
	@Operation(summary = "发送手机验证码")
	@GetMapping("/code")
	public R sendSmsCode(@RequestParam(value = "phone") String phone, @RequestParam(value = "type") String type, @RequestParam(value = "graphCode") String graphCode) throws ClientException {
		return phoneService.sendSmsCode(phone, type, graphCode);
	}

}
